<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	String channel = "user";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Smooth Admin</title>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
	<%@ include file="/WEB-INF/view/include/_js.jspf"%>
	<script type="text/javascript">
		$(document).ready(function () {
			style_path = "<%=path %>/resources/css/colors";
			$("#date-picker").datepicker();
			$("#box-tabs, #box-left-tabs").tabs();
		});
		function validateForm(form) {
		    var arr1 = [ 
		    	form.username, "登录名",
		    	form.nickname, "学籍名",
		    	form.password, "密码",
		    	form.birthday, "出生日期",
		        form.major, "专业" ,
		        form.introduces, "介绍"];
		
		    var result = ItCast.validateRequired(arr1);
		    if (result) {
		        return ItCast.submitting(form);
		    }
		    return false;
		}
	</script>
</head>
<body>
<div id="colors-switcher" class="color">
	<a href="" class="blue" title="Blue"></a>
	<a href="" class="green" title="Green"></a>
	<a href="" class="brown" title="Brown"></a>
	<a href="" class="purple" title="Purple"></a>
	<a href="" class="red" title="Red"></a>
	<a href="" class="greyblue" title="GreyBlue"></a>
</div>
<!-- end dialogs -->
<%@ include file="/WEB-INF/view/include/header.jspf"%>
<!-- content -->
<div id="content">
	<!-- end content / left -->
	<%@ include file="/WEB-INF/view/include/left.jspf"%>
	<!-- end content / left -->
	<!-- content / right -->
	<div id="right">
		<!-- forms -->
		<div class="box">
			<!-- box / title -->
			<div class="title">
				<h5>
					学生信息
				</h5>
			</div>
			<!-- end box / title -->
			<form id="form" action="<%=path %>/user/edit.html" method="post" onsubmit="return validateForm(this)">
			<input type="hidden" name="id" value="${user.id }">
			<input type="hidden" name="password" value="${user.password }">
				<div class="form">
					<div class="fields">
						<div class="field  field-first">
							<div class="label">
								<label for="input-small">
									登录名:
								</label>
							</div>
							<div class="input">
								<input type="text" id="input-small" name="username"
									class="small" value="${user.username }" />
							</div>
							<div>${inputerror }</div>
						</div>
						<div class="field">
							<div class="label">
								<label for="input-small">
									学籍姓名:
								</label>
							</div>
							<div class="input">
								<input type="text" id="input-small" name="nickname"
									class="small"  value="${user.nickname }"/>
							</div>
						</div>
						
						<div class="field">
							<div class="label">
								<label for="select">
									性别:
								</label>
							</div>
							<div class="select">
								<select id="select" name="sex">
									<option value="1" ${user.sex==1 ? 'selected="selected"' : ''}>
										男
									</option>
									<option value="2" ${user.sex==2 ? 'selected="selected"' : ''}>
										女
									</option>
								</select>
							</div>
						</div>
						<div class="field">
							<div class="label">
								<label for="date">
									出生日期:
								</label>
							</div>
							<div class="input">
								<input type="text" id="date" name="birthday" class="date"
									 value="${user.birthday }" />
							</div>
						</div>
						<div class="field">
							<div class="label">
								<label for="autocomplete">
									专业:
								</label>
							</div>
							<div class="input">
								<input type="text" id="major" name="major" class="small"
									 value="${user.major }"  />
							</div>
						</div>
						
						<div class="field">
							<div class="label label-textarea">
								<label for="textarea">
									个人简介:
								</label>
							</div>
							<div class="textarea textarea-editor">
								<textarea id="textarea" name="introduces" cols="50" rows="12"
									class="editor">${user.introduces }</textarea>
							</div>
						</div>
						<div class="field">
							<div class="label">
								<label for="select">
									状态:
								</label>
							</div>
							<div class="select">
								<select id="select" name="enabled">
									<option value="0" ${user.enabled == 0 ? 'selected="selected"' : ''}>
										在校
									</option>
									<option value="1" ${user.enabled == 1 ? 'selected="selected"' : ''}>
										离校
									</option>
								</select>
							</div>
						</div>
						<div class="field">
							<div class="label">
								<label for="select">
									权限:
								</label>
							</div>
							<div class="select">
								<select id="select" name="security">
									<option value="1" ${roleId == 1 ? 'selected="selected"' : ''}>
										普通会员
									</option>
									<option value="3" ${roleId == 3 ? 'selected="selected"' : ''}>
										学生会管理员
									</option>
								</select>
							</div>
						</div>
						<div class="buttons">
							<c:if test="${user.username!='admin'}">
								<input type="submit" name="submit" value="修改" />
								<input type="reset" name="reset" value="重写" />
							</c:if>
						</div>
					</div>
				</div>
			</form>
		</div>
		<!-- end forms -->
	</div>
	<!-- end content / right -->
</div>
<!-- end content -->
<!-- footer -->
<%@ include file="/WEB-INF/view/include/footer.jspf"%>
<!-- end footert -->
</body>
</html>